Chris Pollett > Old Classes >
CS116b

( Print View )

Student Corner:
  [Grades Sec1]

  [Submit Sec1]

  [Email List Sec1]

  [
Lecture Notes]

Course Info:
  [Texts & Links]
  [Topics]
  [Grading]
  [HW Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]

Practice Exams:
  [Mid1]  [Mid2]  [Final]

                           












HW#2 --- last modified March 02 2019 21:14:54..

Solution set.

Due date: Mar 14

Files to be submitted:
  SplineDrawer.cpp

Purpose: To gain experience with Bezier and B-spline curves.

Specification:

For this homework, you should write a program which will let you draw splines and then extrude them in 3D. When run your program should open a GLUT window with title "Constructive Spline Drawer". A system of coordinate axes should be drawn at (0,0,0). At the bottom of the screen should be drawn a numbers which indicate the current (x,y,z) location of the viewer. The near clipping plane should be imagined as perpendicular to this vector at some fixed distance and the clipping window is 300 by 300 and centered on (x,y,z). When one clicks in this window your program should draw a point where the x-y location given by the mouse callback are interpreted as values on the clipping window. The shift up and down keys allow you to move in and out along the vector between (x,y,z) and the origin. To keep things simple you can't move closer to the origin than some fixed distance of your choice. The left and right keys rotate the current viewing plane/clipping window counter-clockwise/clockwise around (x,y,z). Finally, the up and down keys let you move up and down where up and down are interpreted according to what up and down is in the clipping window. The most important part of your program is what happens when you hit space. When you hit and hold space, a B-spline should be drawn using the points on the screen since the last time space was hit. As you hold space this spline should be extruded in the direction between (x,y,z) and (0,0,0) until you release space. To draw the surfaces I want you to either use the GLU spline functions or your own hand-coded drawing functions. Hitting the `1' key controls which of these two options is used. Your hand-coded functions should make use of both forward differencing and the subdivision method. For the latter you will need to convert between the B-spline representation and the Bezier representation before you start doing subdivisions.

Point Breakdown

Departmental coding guidelines for C++ followed 1pt
Window shows up and clipping window as described 1pt
Viewing controls as described. (1pt for each direction of motion)3pts
Using mouse to draw points 2pts
Using GLU functions to draw splines and extrude 1pt
Use subdivision method correctly1pt
Your B-splines draw correctly1pt
Total10pts